Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapt code to amsgrad supported adamw #9568

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

HydrogenSulfate
Copy link
Contributor

@HydrogenSulfate HydrogenSulfate commented Dec 4, 2024

PR types

New features

PR changes

APIs

Description

PaddlePaddle/Paddle#68079中对adam/adamw新增了amsgrad参数,但是对于_C_ops的直调行为是不兼容升级,因此对代码进行适配

Copy link

paddle-bot bot commented Dec 4, 2024

Thanks for your contribution!

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.95%. Comparing base (14ed2a2) to head (e25aeb0).
Report is 5 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9568      +/-   ##
===========================================
+ Coverage    52.83%   52.95%   +0.11%     
===========================================
  Files          701      701              
  Lines       110577   110577              
===========================================
+ Hits         58427    58551     +124     
+ Misses       52150    52026     -124     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# support amsgrad: https://github.com/PaddlePaddle/Paddle/pull/68079
self.support_amsgrad = (
"amsgrad" in inspect.signature(paddle.optimizer.AdamW.__init__).parameters
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种写法是默认amsgrad吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种写法是默认amsgrad吗?

不,这个support_amsgrad的意思是说当前paddle是否支持amsgrad,因为支持amsgrad后,adam/adamw的C_ops接口有变动,位置参数发生变化,所以需要用这个flag表示当前运行的paddle是amsgrad之前的还是之后的。是否启用amsgrad是根据 self._amsgrad 决定的

Copy link
Collaborator

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZHUI ZHUI merged commit dfbd8f9 into PaddlePaddle:develop Dec 6, 2024
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants